Precision (machine learning)
Precision is the proportion of all the model’s positive classifications that are actually positive. It is a metric for classification models that answers the following question:1
When the model predicted the positive class, what percentage of the predictions were correct?
Here is the formula:
which means:
where:
- True positive means the model correctly predicted the positive class.
- False positive means the model mistakenly predicted the positive class.
Precision improves as false positives decrease, while recall improves when false negatives decrease. They often show an inverse relationship, where improving one of them worsens the other. (See also: F1 score)
When (not) to use
Use when it’s very important for positive predictions to be accurate.2
In an imbalanced dataset where the number of actual positives is very, very low, say 1-2 examples in total, precision is less meaningful and less useful as a metric.2